package im.xz.cn.xiacore.menu.playerInfoMenu;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
public class playerMenuEvent implements Listener {
    @EventHandler
    public void qwq(InventoryClickEvent event) {
        try {
            if (event.getView().getTitle().equals(ChatColor.LIGHT_PURPLE + "繁星梦 - 玩家菜单")) {
                event.setCancelled(true);
                Player player = (Player) event.getWhoClicked();
                ItemStack item = event.getCurrentItem();
                try {
                    if (item.getType().equals(Material.BARRIER)) {
                        player.closeInventory();
                        player.performCommand("menu");
                    }
                }catch (NullPointerException ignore) {

                }

            }
        }catch (NullPointerException ignore) {

        }
    }
}